import routes from './routes';
import {Routes,Route} from 'react-router-dom';
// 引入鉴权组件
import Author from './Author';
function RouterView(){
    return (
        <Routes>
            {
                routes.map((item,index)=>{
                    return <Route path={item.path} element={item.author?<Author OldComponent={item.element}/>:item.element} key={index}>
                        {
                            item.children && item.children.map((item2,index2)=>{
                                return <Route key={index2} path={item2.path} element={item2.author?<Author OldComponent={item2.element}/>:item2.element} />
                            })
                        }
                    </Route>
                })
            }
        </Routes>
    )
}

export default RouterView;